include $(top_dir)/helpers.mk

src_dir_telebot := $(shell pwd)/telebot/
src_dir_zlog := $(shell pwd)/zlog/
src_dir_cmoka := $(shell pwd)/cmoka/

all: build_telebot build_zlog build_cmoka

build_telebot: $(telebot_lib)

$(telebot_lib): $(src_dir_telebot)
	@$(call print_info,Building Telebot Framework)
	@mkdir -p $(telebot_dep_build_dir)
	@cd $(telebot_dep_build_dir) && cmake $(<D)
	@cd $(telebot_dep_build_dir) && make

build_zlog: $(zlog_lib)

$(zlog_lib): $(src_dir_zlog)
	@$(call print_info,Building zlog library)
	@mkdir -p $(zlog_dep_build_dir)
	@cd $(src_dir_zlog) && make
	@cd $(src_dir_zlog) && make install PREFIX=$(zlog_dep_build_dir)

build_cmoka: $(cmoka_lib)

$(cmoka_lib): $(src_dir_cmoka)
	@$(call print_info,Building cmoka)
	@mkdir -p $(cmoka_dep_build_dir)
	@cd $(cmoka_dep_build_dir) && cmake $(src_dir_cmoka)
	@cd $(cmoka_dep_build_dir) && make